-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(FileUploader): expose ref to clear files #18267
base: main
Are you sure you want to change the base?
feat(FileUploader): expose ref to clear files #18267
Conversation
✅ Deploy Preview for v11-carbon-web-components ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -342,6 +344,6 @@ FileUploader.propTypes = { | |||
* sizes. | |||
*/ | |||
size: PropTypes.oneOf(['sm', 'md', 'lg']), | |||
}; | |||
} as PropTypes.ValidationMap<FileUploaderProps>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was getting TS errors and added this as a workaround:
accept: Type '(string | null | undefined)[]' is not assignable to type 'string[]'
filenameStatus: Type 'string' is not assignable to type '"edit" | "complete" | "uploading"'.
@@ -50,38 +50,22 @@ describe('FileUploader', () => { | |||
|
|||
it('should clear all uploaded files when `clearFiles` is called on a ref', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This unit test seems wrong it was trying to test if remove button works. I reverted back to a version from history that actually test clearFiles()
function
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #18267 +/- ##
=======================================
Coverage 84.31% 84.32%
=======================================
Files 404 404
Lines 14359 14360 +1
Branches 4606 4606
=======================================
+ Hits 12107 12109 +2
+ Misses 2090 2089 -1
Partials 162 162 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for doing that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, This LGTM thanks for contributing and giving detailed explanation.
Closes #18223
Clear files in
<FileUploader>
using refChangelog
New
<FileUploader>
and exposeclearFiles()
Testing / Reviewing
Added temporary story to test the new ref